<%@ page contentType="text/html; charset=UTF-8" %>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@ page import="com.wlcorp.forcazamis.domain.system.Staff" %>
<%@ page import="com.wlcorp.forcazamis.domain.baseinfo.Customer" %>
<%
	List staffList = (List)request.getAttribute("staffList");
	Customer customer = (Customer)request.getAttribute("customer");
%>
<html>
<head>
	<title>客户信息更新</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<meta http-equiv="Pragma" content="no-cache"><meta http-equiv="Cache-Control" content="no-cache"><meta http-equiv="Expires" content="0">
	<link href="${pageContext.request.contextPath}/css/css.css" rel=stylesheet>
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/button_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/form_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/table_css.css" type="text/css">
	<link rel="stylesheet" href="${pageContext.request.contextPath}/css/pagetitle_css.css" type="text/css">
	<script language="javascript" src="${pageContext.request.contextPath}/script/validator.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/script/calendartime.js"></script>
	<script type="text/javascript">
		function doSave(){
			if(!fieldIsNotEmpty(document.forms["customerForm"].customerName)){
				return;
			}
			if(!fieldValidateByRegexp(document.forms["customerForm"].email,REGEXP_EMAIL)){
				return;
			}
			if(!fieldValidateByRegexp(document.forms["customerForm"].phone,REGEXP_INTEGER)){
				return;
			}
			if(!fieldValidateByRegexp(document.forms["customerForm"].linkmanPhone,REGEXP_INTEGER)){
				return;
			}
			if(!fieldValidateByRegexp(document.forms["customerForm"].linkmanEmail,REGEXP_EMAIL)){
				return;
			}
			document.forms["customerForm"].submit();
		}
		function goback(){
			window.location = "${pageContext.request.contextPath}/baseinfo/customerManager.do?method=customerManager";
		}
	</script>
</head>
<body>
<form name="customerForm" method="POST" action="${pageContext.request.contextPath}/baseinfo/customerManager.do?method=modifyCustomer">
<input type="hidden" name="customerId" value="${customer.customerId}"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="30">
	<tr> 
	  <td width="22" class="page_titlebar_head">&nbsp;</td>
	  <td class="page_titlebar_bg" width="981">客户编辑</td>
	</tr>
</table>
<center>
<table width="80%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100">
  <tr class="InputFrameLine">
  		<td colspan="4" class="table_unfold_titlebar_small_bg">&nbsp;&nbsp;<b>客户基本信息编辑</b></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="customerFullName_TEXT">客户全称</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="customerFullName" value="${customer.customerFullName}" style="width:150px" length="20"/></td>
		<td class="table_label" width="20%" id="customerName_TEXT">客户简称</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="customerName" value="${customer.customerName}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="phone_TEXT">电话</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="phone" value="${customer.phone}" style="width:150px" maxlength="20"/></td>
		<td class="table_label" width="20%" id="mobile_TEXT">手机</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="mobile" value="${customer.mobile}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="email_TEXT">Email</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="email" value="${customer.email}" style="width:150px" maxlength="30"/></td>
		<td class="table_label" width="20%" id="msn_TEXT">MSN</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="msn" value="${customer.msn}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="fax_TEXT">传真</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="fax" value="${customer.fax}" style="width:150px" maxlength="30"/></td>
		<td class="table_label" width="20%">&nbsp;</td>
		<td width="30%"></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="country_TEXT">国籍</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="country" value="${customer.country}" style="width:150px" maxlength="20"/></td>
		<td class="table_label" width="20%" id="continent_TEXT">所属大洲</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="continent" value="${customer.continent}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
		<td class="table_label" width="20%" id="address_TEXT">地址</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="address" value="${customer.address}" style="width:300px" maxlength="1000"/></td>
		<td class="table_label" width="20%" id="linkmanName_TEXT">主要联系人姓名</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="linkmanName" value="${customer.linkmanName}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="linkmanPhone_TEXT">联系人电话</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="linkmanPhone" value="${customer.linkmanPhone}" style="width:150px" maxlength="20"/></td>
		<td class="table_label" width="20%" id="linkmanMobile_TEXT">联系人手机</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="linkmanMobile" value="${customer.linkmanMobile}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
        <td class="table_label" width="20%" id="linkmanEmail_TEXT">联系人Email</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="linkmanEmail" value="${customer.linkmanEmail}" style="width:150px" maxlength="30"/></td>
		<td class="table_label" width="20%" id="linkmanMsn_TEXT">联系人MSN</td>
		<td width="30%">&nbsp;<input class="input" type="text" name="linkmanMsn" value="${customer.linkmanMsn}" style="width:150px" maxlength="20"/></td>
  </tr>
  <tr class="InputFrameLine">
		<td class="table_label" colspan="4" width="100%">
			<table width="80%" class="InputFrameMain" cellspacing="0" cellpadding="0" border="0" height="100" align="center">
				<tr class="InputFrameLine">
					<td class="table_label" width="20%" align="left">客户分配给员工</td>
  				</tr>

			<%
				if(null!=staffList&&staffList.size()>0){
					for(int i=1;i<staffList.size()+1;i++){
						Staff staff=(Staff)staffList.get(i-1);
						if((i%5==1)){
							out.print("<tr>");
						}
			%>

			<td><input type="checkbox" name="staffId" value="<%=staff.getStaffId()%>" <%if(null!=customer.getStaffs()&&customer.getStaffs().size()>0){for(Iterator iter = customer.getStaffs().iterator(); iter.hasNext();){Staff staff1=(Staff)iter.next();if(staff1.getStaffId()==staff.getStaffId()){out.print("checked");}}}%>/>&nbsp;<%=staff.getStaffName()%></td>
			<%
			  		if(i>4&&i%5==0){
				  		out.print("</tr>");
			  		 }
			 		}
			   }
			%>
		</table>
		</td>
  </tr>
  <tr class="InputFrameLine">
  	<td width="100%" colspan="4" align="center"><input type="button" class="button_common" name="save_button" value="保存" onclick="javascript:doSave()">
  	<input type="button" class="button_common" name="goback_button" value="返回" onclick="javascript:history.go(-1);"></td>
  </tr>
</table>
</center>
</form>
${message}
</body>
</html>
